// 音效管理类
class SoundManager {
    constructor() {
        this.sounds = {
            scanSound: document.getElementById('scanSound'),
            errorSound: document.getElementById('errorSound')
        };
    }

    // 播放音效
    playSound(soundId) {
        const sound = this.sounds[soundId];
        if (sound) {
            sound.currentTime = 0;
            sound.play().catch(e => console.error('Error playing sound:', e));
        }
    }

    // 添加新的音效
    addSound(id, element) {
        this.sounds[id] = element;
    }

    // 移除音效
    removeSound(id) {
        delete this.sounds[id];
    }
}

// 创建全局音效管理器实例
window.soundManager = new SoundManager(); 